package ext;

import org.junit.Test;

import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit;
import java.util.function.*;
import java.util.stream.IntStream;

public class ColyTest {
    
    @Test
    public void test() {
        Function<Integer, Function<Integer,Function<Integer, Integer>>> calc = x -> y -> z -> z + 1;
        int res = calc.apply(1).apply(2).apply(3);
        System.out.println(res);
    }

    public static void main(String[] args) {
        IntStream.range(0, 100).peek(ColyTest::debug).count();
        ForkJoinPool forkJoinPool = new ForkJoinPool(20);
        forkJoinPool.submit(() -> IntStream.range(0, 100).peek(ColyTest::debug).count());
        // forkJoinPool.shutdown();
        
        try {
            TimeUnit.HOURS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void test1() {
    }

    public static void debug(int t) {
        System.out.println(t);
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

    }
}
